package com.outstanding.his.check.dao.impl;

import org.springframework.dao.DataAccessException;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import com.outstanding.his.check.dao.ICheckDao;
import com.outstanding.his.check.domain.Check;

public class HibernateCheckDao extends HibernateDaoSupport implements ICheckDao {

	@Override
	public Check submitCheck(Check check) throws DataAccessException {
		this.getHibernateTemplate().saveOrUpdate(check);
		return check;
	}

	@Override
	public Check getCheck(Integer checkId) throws DataAccessException {
		Check check = (Check)this.getSession().load(Check.class, checkId);
		return check;
	}

	@Override
	public Check getCheckByPatientId(Integer patientId)
			throws DataAccessException {
		Check check = (Check)this.getSession().load(Check.class, patientId);
		return check;
	}
	
}